# blog/models.py
from django.db import models

class Article(models.Model):
    #title,author,price,content,pub_date,status
    #id字段整形，自增，主键;新增字段时，需要指定主键
    id = models.AutoField(primary_key=True)
    title = models.CharField(max_length=200)
    #作者
    author = models.CharField(max_length=100)
    price = models.DecimalField(max_digits=10, decimal_places=2)
    content = models.TextField()
    pub_date = models.DateTimeField('date published')
    #status状态（整型），是否发布，默认是0，1表示发布
    status = models.IntegerField(default=0)

    class Meta:
        app_label = 'blog'  # 显式声明应用标签
    def __str__(self):
        return self.title



article = Article(title='测试标题',content='测试内容')